// 用于测试mock数据是否正常工作
import { mockData } from './index'

// 测试用户数据
export const testUserData = () => {
  console.log('=== 测试用户数据 ===')
  const users = mockData.system.user.getUserList()
  console.log('用户列表:', users)
  
  const searchResult = mockData.system.user.searchUsers('admin')
  console.log('搜索结果:', searchResult)
}

// 测试项目数据
export const testProjectData = () => {
  console.log('=== 测试项目数据 ===')
  const projects = mockData.pypm.project.getProjectList()
  console.log('项目列表:', projects)
  
  const projectPage = mockData.pypm.project.getProjectPage({ pageNum: 1, pageSize: 10 })
  console.log('分页项目:', projectPage)
  
  const project = mockData.pypm.project.getProjectById('1')
  console.log('单个项目:', project)
  
  const statistics = mockData.pypm.project.getProjectStatistics()
  console.log('项目统计:', statistics)
}

// 运行所有测试
export const runAllTests = () => {
  testUserData()
  testProjectData()
}

// 如果直接运行此文件，则执行测试
if (import.meta.vitest) {
  // 这是为了在vitest测试中使用
  describe('Mock Data Tests', () => {
    it('should return user data correctly', () => {
      const users = mockData.system.user.getUserList()
      expect(users).toHaveLength(5)
    })
    
    it('should return project data correctly', () => {
      const projects = mockData.pypm.project.getProjectList()
      expect(projects).toHaveLength(5)
    })
  })
}